package cn.skyquant.quant4j.service.boot.model.dict;

import cn.skyquant.quant4j.api.dict.DictService;
import cn.skyquant.quant4j.api.dict.Dictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("DictServiceImpl")
public class DictServiceImpl implements DictService {
    @Autowired
    DictRepository dictRepository;

    public Dictionary getDict(String group){
        List<Dict> dicts = dictRepository.findByGroupCode(group);
        Dictionary dictionary= new Dictionary();
        dictionary.group = group;
        dicts.forEach(x->dictionary.put(x.dictKey,x.dictValue));
        return dictionary;
    }

}
